import { request } from "../network/request";

export function getExam() {
  return request({
    url: "/getExam",
    method: "GET",
  });
}

export function addExam({ newTitle, newTip, newArea, newTime, newTeacher }) {
  return request({
    url: "/addExam",
    method: "POST",
    data: {
      title: newTitle,
      tip: newTip,
      area: newArea,
      time: newTime,
      teacher: newTeacher,
    },
  });
}

export function delExam({ id }) {
  return request({
    url: "/delExam",
    method: "POST",
    data: {
      _id: id,
    },
  });
}

export function editExam({ title, tip, area, time, teacher, _id }) {
  return request({
    url: "/editExam",
    method: "POST",
    data: {
      title: title,
      tip: tip,
      area: area,
      time: time,
      teacher: teacher,
      _id: _id,
    },
  });
}

export function getScore() {
  return request({
    url: "/getScore",
    method: "GET",
  });
}

export function addScore({ name, type, Sclass, idNo, exam, score, time }) {
  return request({
    url: "/addScore",
    method: "POST",
    data: {
      name: name,
      type: type,
      Sclass: Sclass,
      idNo: idNo,
      exam: exam,
      score: score,
      time: time,
    },
  });
}

export function delScore({ id }) {
  return request({
    url: "/delScore",
    method: "POST",
    data: {
      _id: id,
    },
  });
}

export function getpaScore() {
  return request({
    url: "/getPaScore",
    method: "GET",
  });
}

export function addpaScore({ name, type, Sclass, idNo, exam, score, time }) {
  return request({
    url: "/addPaScore",
    method: "POST",
    data: {
      name: name,
      type: type,
      Sclass: Sclass,
      idNo: idNo,
      exam: exam,
      score: score,
      time: time,
    },
  });
}

export function delpaScore({ id }) {
  return request({
    url: "/delPaScore",
    method: "POST",
    data: {
      _id: id,
    },
  });
}
